<template>
	<view class="user">

		<!-- 用户头像header -->
		<view class='member-top'>
			<view class='member-top-c' style="margin: 0 17px;width: auto;">
				<template v-if="hasLogin">
					<!--已经授权-->
					<view style="display: flex;justify-content: space-between;flex-direction: row;height: 60px;width: 100%;margin-top: 80upx;position: relative;">
						<view class="user-head-img" style="margin: 0;">
							<image class='user-head-img' mode="aspectFill" :src='avatar' style="margin: 0;"></image>
						</view>
						<view style="display: flex;flex-direction: row; align-items: flex-start;flex: 1;margin-left: 12px;">
							<view class="ph-wrapper">
								<view class="login-name-but name-text" style="font-size: 18px;font-weight: bold;" >{{ nickname }}</view>
							</view>
						
							<view style="display: flex;margin-top: 10upx;">
							
								<image src="../../static/images/feng_hui.png" style="width: 71px;height: 23px;" v-if="level===2"></image>
								<image src="../../static/images/luye_hui.png" style="width: 71px;height: 23px;" v-if="level===3"></image>
							</view>
						
						</view>
						<view class="qiandao" @click="open">
							<image src="../../static/images/qian_ion.png" style="width: 20px;height: 20px;"></image>
							<view style="font-weight: bold;">签到</view>
						</view>
						<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="bangsj" v-if="phoneNumber==''">绑定手机号</button>
						<view class="bangsj" style="border: none;" v-if="phoneNumber">{{phoneNumber}}</view>
					</view>
				</template>
				<template v-else>
					<view style="display: flex;justify-content: space-between;flex-direction: row;height: 60px;width: 100%;margin-top: 80upx;position: relative;">
						<view class="user-head-img" style="margin: 0;" @click="getLogin">
							<image class='user-head-img' mode="aspectFill" src="/static/images/zhen1.jpg" style="margin: 0;"></image>
						</view>
						<view style="display: flex;flex-direction: row; align-items: flex-start;flex: 1;margin-left: 12px;">
							<view class="ph-wrapper">

								<button @getuserinfo="getLogin" open-type="getUserInfo" class="login-name-but1" style="font-size: 18px;font-weight: bold; border-radius: 0;
		    margin: 0;padding: 0;
		    background: none;color: #FFFFFF;line-height: 1;margin-top: 5px;"
								 hover-class="btn-hover">立即授权</button>


								<button @getuserinfo="getLogin" open-type="getUserInfo" hover-class="btn-hover" class="bangsj">绑定手机号</button>
							</view>
						
						</view>
						<view class="qiandao" @click="open">
							<image src="../../static/images/qian_ion.png" style="width: 20px;height: 20px;"></image>
							<view style="font-weight: bold;">签到</view>
						</view>
					</view>


					<!--未授权-->
				</template>
			</view>

			<!--积分 点赞 列表-->
			<view class="inte-list">
				<view class="inte-item" @click="hanldIntegral(integral)">
					<view class="init-title">{{integral}}</view>
					<view>我的积分</view>
				</view>
				<view class="inte-item" @click="hanldActive()">
					<view class="init-title">{{activity}}</view>
					<view>活动收藏</view>
				</view>
				<view class="inte-item" @click="hanldtweetLike()">
					<view class="init-title">{{star}}</view>
					<view>推文点赞</view>
				</view>
			</view>

			<!--开通卡-->
		
			
			<view class="car-wrapper">
				
				<!--会员-->
				<view v-if='level===0' class="flex-style">
					<image src="../../static/images/luzhuan.png"></image>
					<view  class="flex-style">
					<view class="car-text" style="color: #41C977;">开通绿叶卡即可享会员权益</view>
						<view class="car-but" @click="hanldMenberCar()" style="background-color: #41C977;color: #27282D;" >立即开通</view>
					</view>
				</view>
				
				<!--绿叶-->
				<view v-else-if='level===3' class="flex-style">
					<image src="../../static/images/luzhuan.png"></image>
					<view  class="flex-style">
						<view class="car-text" style="color: #41C977;">绿叶卡于{{level_time}}过期</view>
						<view class="car-but"  style="background-color: #41C977;color: #27282D;" @click="hanldXufei()">已交年费</view>
					</view>
				</view>
				
				
				<!--枫叶-->
				<view v-else-if='level===2' class="flex-style">
					<image src="../../static/images/fengzuan.png"></image>
					<view  class="flex-style">
						<view class="car-text" style="color: #EFD7AA;">枫叶卡于{{level_time}}过期</view>
						<view class="car-but" @click="hanldXufei()" style="background-color: #EFD7AA;color: #27282D;">已交年费</view>
					</view>
				</view>
				
				<!--业主-->
				<view v-else-if='level===1' class="flex-style">
					<image src="../../static/images/fengzuan.png"></image>
					<view  class="flex-style;">
						<view class="car-text" style="color: #EFD7AA;">开通枫叶卡即可享会员权益</view>
						<view class="car-but"  @click="hanldMenberCar()" style="background-color: #EFD7AA;color: #27282D;" >立即开通</view>
					</view>
				</view>
				
				<view v-else class="flex-style">
					<image src="../../static/images/luzhuan.png"></image>
					<view style="color: #41C977;padding-left: 10px;">授权登录后可开通会员卡</view>
				</view>
				
			</view>
			

		</view>
		<!-- 用户头像header end -->




		<!-- 订单列表信息 -->

		<view class='member-grid'>
			<view class='member-item' v-for="(item, index) in orderItems" :key="index" @click="orderNavigateHandle(index)">
				<view class="badge color-f" v-if="item.nums">{{ item.nums }}</view>
				<image class='member-item-icon' :src='item.icon'></image>
				<text class='member-item-text'>{{ item.name }}</text>
			</view>
		</view>
		<!-- 订单列表end -->

		<!-- 其他功能菜单 -->
		<!-- 列表样式 -->
		<view class="" v-if="list == 1">

			<view class='cell-group margin-cell-group right-img'>
				<view class='cell-item' style="padding: 16px 14px 10px 0;" @click="hanldjifen()">
					<view class='cell-item-hd'>
						<image class='cell-hd-icon' src='../../static/images/jifenshc_no.png' style="vertical-align: bottom;"></image>
						<view class='cell-hd-title'>积分兑换</view>
					</view>
					<view class='cell-item-ft'>
						<image class='cell-ft-next icon' src='../../static/images/left.png' style="width: 10px;height: 14px;margin-right: 10px;"></image>
					</view>
				</view>
			
				<view class='cell-item' style="padding: 16px 14px 10px 0;" @click="hanldfadie()">
					<view class='cell-item-hd'>
						<image class='cell-hd-icon' src='../../static/images/bianji_no.png' style="vertical-align: bottom;"></image>
						<view class='cell-hd-title'>我的发帖</view>
					</view>
					<view class='cell-item-ft'>
						<image class='cell-ft-next icon' src='../../static/images/left.png' style="width: 10px;height: 14px;margin-right: 10px;"></image>
					</view>
				</view>
				<view class='cell-item' style="padding: 16px 14px 10px 0;" @click="hanldmylist()">
					<view class='cell-item-hd'>
						<image class='cell-hd-icon' src='../../static/images/info.png' style="vertical-align: bottom;"></image>
						<view class='cell-hd-title'>消息列表</view>
					</view>
					<view class='cell-item-ft'>
						<view class="mesage" v-if="notice_md5">{{messNum}}</view>
						<image class='cell-ft-next icon' src='../../static/images/left.png' style="width: 10px;height: 14px;margin-right: 10px;"></image>
					</view>
				</view>
				<view class='cell-item' style="padding: 16px 14px 10px 0;" @click="hanldyijian()">
					<view class='cell-item-hd'>
						<image class='cell-hd-icon' src='../../static/images/yijian2.png' style="vertical-align: bottom;"></image>
						<view class='cell-hd-title'>意见反馈</view>
					</view>
					<view class='cell-item-ft'>
						<image class='cell-ft-next icon' src='../../static/images/left.png' style="width: 10px;height: 14px;margin-right: 10px;"></image>
					</view>
				</view>
				<view class='cell-item' style="padding: 16px 14px 10px 0;" @click="hanldkefubt()">
					<view class='cell-item-hd'>
						<image class='cell-hd-icon' src='../../static/images/kefu.png' style="vertical-align: bottom;"></image>
						<view class='cell-hd-title'>客服</view>
					</view>
					<view class='cell-item-ft'>
						<image class='cell-ft-next icon' src='../../static/images/left.png' style="width: 10px;height: 14px;margin-right: 10px;"></image>
					</view>
				</view>
				<view class='cell-item' style="padding: 16px 14px 10px 0;">
					<view class='cell-item-hd'>
						<image class='cell-hd-icon' src='../../static/images/yaj.png' style="vertical-align: bottom;"></image>
						<view class='cell-hd-title'>押金</view>
					</view>
					<view class='cell-item-ft'>
						<text style="color: #999999;font-size: 14px;padding: 0 10px;" v-if="deposit==0" @click="hanldyajin()">交押金</text>
						<text style="color: #999999;font-size: 14px;padding: 0 10px;" v-if="deposit>0" @click="hanldNoyajin()">￥{{deposit}} <text style="color: #FF5F49;padding-left: 5px;">点击退还</text></text>
						<image class='cell-ft-next icon' src='../../static/images/left.png' style="width: 10px;height: 14px;margin-right: 10px;"></image>
					</view>
				</view>

			</view>
		</view>


		<!-- 其他功能菜单end -->

		<!--弹框-->
		<uni-popup ref="popup" type="center">
			<view class="qian">
				<image src='../../static/images/qiandao.png' class="qian-img"></image>
				<view style="padding-top: 20px;font-size: 18px;color: #3C3C43;font-weight: bold;">签到领积分</view>
				<view style="font-size: 14px;color: #999999;font-weight: bold;">今日签到可领</view>
				<view style="color: #FF5F49;font-size: 21px;padding: 15px;"><text style="font-size: 31px;font-weight: bold;">{{integralNum}}</text>积分</view>
				<view class="qian-warppper">
					<view class="qian-time" style="background-color: #F7F9FA;" v-for="(item,index) in signList" :class="{ sticStyle: item.sign }">
						<image src="/static/images/yes_qian.jpg"></image>
						<view class="text" style="color: #909699;" :class="{ sticStyle: item.sign }">{{item.week}}</view>
					</view>
				</view>
				<view class="qian-but2" v-if="signBut==true">已签到</view>
				<view class="qian-but" v-if="signBut==false" @click="hanldQian()">立即签到</view>
				<view style="color: #FF5F49;"><text style="color: #FF5F49;">总积分：</text>{{integral}}</view>
			</view>
		</uni-popup>
		<!--客服弹框-->
		<uni-popup ref="popupkf" type="center">
			<view class="qian">
				<image :src='kefu.kefu_avatar' class="qian-img" style="    width: 67px;
    height: 67px;
    border-radius: 50%;
    margin-top: -40px;"></image>
				<view class="kf-title">官方客服-{{kefu.kefu_nickname}}</view>
				<view class="kf-main">这是您的专属客服</view>
				<image :src='kefu.kefu_qrcode' class="kf-img"></image>
				<view class="kf-text">下载二维码或截图保存图片</view>
				<view class="kf-but" @click="downloadImageOfMp(kefu.kefu_qrcode)">下载二维码</view>
			</view>
		</uni-popup>

		<!--交押金弹框-->
		<uni-popup ref="cash" type="center">
			<view class="cash">
				<view class="cash-title">开通会员即可借阅</view>
				<view class="cash-text">需绑定会员卡并且￥{{deposit2}}押金才能借阅，立即开通可使用此功能</view>
				<view class="cash-but">
					<view class="cash-left" @click="hanldyajingno()">我知道了</view>
					<view class="cash-right" @click="hanldPaly()">开通会员</view>
				</view>
			</view>
		</uni-popup>

		<!--退押金弹框-->
		<uni-popup ref="recash" type="center">
			<view class="cash" style="padding: 0 23px;">
				<view class="cash-title">是否退押金？</view>
				<view class="cash-text">提交退还押金申请后，系统将会在7个工作日左右审核成功，请注意查看余额变动，退款成功后您不可再使用此功能，是否继续退？</view>
				<view class="cash-but" style="margin-top: 20px;">
					<view class="cash-left" @click="hanldjixutui()">继续退</view>
					<view class="cash-right" @click="hanldzaixiang()">我再想想</view>
				</view>
			</view>
		</uni-popup>

		<!--授权弹框-->
		<view class="search-body">
			<view class="dialog-container" v-if="tokenShow">
				<view class="dialog-mask"></view>
				<view class="dialog-info">
					<view class="dialog-title">您还未授权</view>
					<view class="dialog-content">请先授权再进行操作</view>
					<view class="dialog-footer">
						<button @click="dontLogin()" class="dialog-btn">暂不登录</button>
						<button @getuserinfo="getLogin" open-type="getUserInfo" class="dialog-btn" style="background-color:#FF5F49;color: #fff;">立即授权</button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>


<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'

		export default {
		components: {
			uniPopup,
			uniPopupMessage,
			uniPopupDialog,
			
		},
		data() {
			return {
				        notice_md5: false, // 标红显示

				tokenShow: "", //token控制
				cash: false, //押金
				open_id: '',
				hasLogin: false,
				orderItems: [{
						name: '待付款',
						icon: '../../static/images/yinghang_yes.png',
						nums: 0
					},
					{
						name: '待参与',
						icon: '../../static/images/daihukuan.png',
						nums: 0
					},
					{
						name: '已完成',
						icon: '../../static/images/yiwanchen.png',
						nums: 0
					}
				],
				utilityMenus: {
					integral: {
						name: '积分兑换',
						icon: '../../static/images/jifenshc_no.png',
						router: '/pages/member/IntegralMall/IntegralMall',
						unshowItem: false
					},
				
					Posting: {
						name: '我的发帖',
						icon: '../../static/images/bianji_no.png',
						router: '/pages/member/myPosting/myPosting',
						unshowItem: false
					},
					idea: {
						name: '意见反馈',
						icon: '../../static/images/yijian2.png',
						router: '/pages/member/idea/index',
						unshowItem: false
					},
					service: {
						name: '客服',
						icon: '../../static/images/yijian2.png',
						router: '/pages/user/service',
						unshowItem: false
					},

				},
				list: 1,
				suTipStatus: false,

				token: "", //获取token
				userinfo: {},
				code: "",
				show: false,
				nickname: "", //username
				avatar: "", //用户头像
				phoneNumber: "", //用户手机号码
				signList: "", //签到列表
				signBut: '', //签到按钮
				integral: 0, //积分
				level: Number, //等级
				activity: 0,
				star: 0,
				kefu: "",
				integralNum: "",
				mobile: "",
				level_time:"",//过期时间
				deposit:0,//押金
				deposit2:"",
				messNum:""
			}
		},
		onShow() {
			this.initData();
			this.getSignList();
			this.hanldKefu()
			this.token = uni.getStorageSync('accessToken')
			if(this.token==''){
				this.hasLogin = false
			}else{
				this.hasLogin = true
			}
			
			
			
			   this.$http.get("/moments/news").then(response => {
			      let res = response.data
				  if(res.code==0){
				    let number = res.msg;
					this.messNum = res.msg;
					let listMd = number;
					console.log(listMd);
					console.log("listMd");
					let notice_md5 = uni.getStorageSync("notice_md5");
					console.log(notice_md5)
					console.log("notice_md5")
					if (listMd != notice_md5) {
					  this.notice_md5 = true;
					} else{
						 this.notice_md5 = false;
					}
				  }
				
			    });
	
		 },
		onLoad() {
			this.getSignList();
			this.hanldKefu();
			this.getConfig();
		
		},
		methods: {
			//点击活动收藏列表
			hanldActive(){
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					uni.navigateTo({
						url:'activiCollection'
					})
				}
			},
			//点赞列表
			hanldtweetLike(){
				if (this.token == '') {
					this.tokenShow = true;
				}if (this.token) {
					uni.navigateTo({
						url:'tweetLike'
					})
				}
			},
			
			getConfig() {
				this.$http.get('/index/config').then((response) => {
					const res = response.data;
					if (res.code == 0) {
						this.deposit2 = res.data.deposit;  //绿
					}
				})
			},
			getPhoneNumber (e) {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					if(e.detail.errMsg=="getPhoneNumber:ok"){
							console.log('用户点击了接受');
							this.hanldBind(e);
						
						}else{
							console.log('用户点击了拒绝') ;  
				    }
				}
			},
			//签到弹框
			open() {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					this.$refs.popup.open()
				}
			},
			//暂不登录
			dontLogin() {
				this.tokenShow = false
			},
			//跳转会员卡(开通)
			hanldMenberCar() {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					uni.navigateTo({
						url: '/pages/member/membershipCard/membershipCard'
					})
				}
			},
			//会员卡续费
			hanldXufei(){
				let aa = 'xf';
				// console.log(aa+"续费")
				uni.navigateTo({
					url: `/pages/member/membershipCard/membershipCard?xuf=${aa}`
				})
			},
			
			//积分
			hanldIntegral(integral) {
				console.log(this.token)
				console.log("this.token")
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					uni.navigateTo({
						url: `/pages/user/integral?integral=${integral}`
					})
				}
			},
			//活动收藏
			hanldMessList() {
				uni.navigateTo({
					url: '/pages/user/collection'
				})
			},
			//我的列表
			hanldmylist(){
			uni.navigateTo({
				url: `/pages/member/messageList/messageList`
			})	
			},
		

			//积分兑换
			hanldjifen() {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					uni.navigateTo({
						url: '/pages/member/IntegralMall/IntegralMall'
					})
				}

			},
			//系统消息
			hanldxiaoxi() {
				uni.navigateTo({
					url: '/pages/user/message'
				})
			},
			//我的发帖
			hanldfadie() {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					uni.navigateTo({
						url: '/pages/member/myPosting/myPosting'
					})
				}
			},
			//意见反馈
			hanldyijian() {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					uni.navigateTo({
						url: '/pages/member/idea/index'
					})
				}

			},
			//客服
			hanldkefubt() {
				this.$refs.popupkf.open()
			},
			//押金
			hanldyajin() {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					this.$refs.cash.open()
				}
			},
			//关闭交押金弹框
			hanldyajingno(){
				this.$refs.cash.close()
			},
			//退押金
			hanldNoyajin() {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					this.$refs.recash.open()
				}
			},
			//继续推押金
			hanldjixutui(){
				this.$http.post('/user/refund').then((response) => {
					const res = response.data;
					if(res.code==0){
						console.log(res)
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				
					this.$refs.recash.close();
					this.initData();
				})
			}, 
			hanldzaixiang(){
				this.$refs.recash.close()
			},
			orderNavigateHandle(index) {
				if (this.token == '') {
					this.tokenShow = true;
				}
				if (this.token) {
					uni.navigateTo({
						url: `regiIist?id=${index+1}`
					})
				}

			},

			hanldLogin() {
				this.show = true;
			},
			//点击授权登录
			getVxUserInfo() {
				//wx.checkSession检查登录态是否过期
				var that = this;
				wx.checkSession({
					success() {
						//session_key 未过期
						console.log("success token:" + that.token);
						that.hasLogin = true;

					},
					fail() {
						// session_key 已过期
						console.log("fail");
						that.hasLogin = false;

					}
				});
			},
			//获取用户信息
			initData() {

				let that = this;
				console.log(uni.getStorageSync('accessToken'))
				console.log('accessToken')
				if (uni.getStorageSync('accessToken')) {
					this.hasLogin = true;
					this.$http.get('/user/info').then((response) => {

						const res = response.data;
						this.integral = res.data.integral
						this.userInfo = res.data;
						this.level = res.data.level;
						console.log("积分"+this.level)
						this.activity = res.data.activity;
						this.level_time = res.data.level_date;
						this.star = res.data.star;
						this.deposit = res.data.deposit;//押金
						this.phoneNumber = res.data.mobile;
						this.orderItems[0].nums = res.data.order['0'];
						this.orderItems[1].nums = res.data.order['1'];
						console.log(this.phoneNumber)
						console.log(this.userInfo);
						console.log("this.userInfo");
						if (this.userInfo.avatar) {
							this.avatar = this.userInfo.avatar;
						}
						// #ifdef  MP-WEIXIN
						uni.getUserInfo({
							provider: 'weixin',
							success: function(res) {
								console.log(res.userInfo);
								that.nickname = res.userInfo.nickName;
								that.avatar = res.userInfo.avatarUrl;
							}
						});
						// #endif
						uni.setStorageSync('userInfo', JSON.stringify(res.data));
					})
				}
			},


			getLogin() {
				
				var that = this;
				wx.login({
					//获取code 使用wx.login得到的登陆凭证，用于换取openid==token代替
					success(res) {
						if (res.code) {
							console.log(res.code);
							that.code = res.code;
							//使用 wx.getSetting 获取用户当前的授权状态。
							wx.getSetting({
								success(res) {
									if (res.authSetting['scope.userInfo']) { //已授权=>getUserInfo
										wx.getUserInfo({
											success(res) {
												console.log(res)
												console.log("ressss")
												that.userinfo.encryptedData = res.encryptedData;
												that.userinfo.iv = res.iv;
												console.log(that.userinfo)

												const formData = {
													code: that.code,
													avatar: res.userInfo.avatarUrl,
													nickname: res.userInfo.nickName
												}
												that.$http.post('/login/wxLogin', formData).then((response) => {
													const res = response.data;
													console.log(res.data.token);
													if (res.data.token) {
														that.$http.setConfig((config) => { /* 设置全局配置 */
															config.header = {
																...config.header,
																token: res.data.token,
															}
															return config
														})
														wx.setStorageSync("accessToken", res.data.token); //成功之后存入token
													}
													that.token = res.data.token;
													that.hasLogin = true;
													that.initData();
													that.getSignList();
													uni.showToast({
														title: res.msg,
														icon: 'none'
													});
													that.tokenShow = false;
												})
											},
											fail(err) {
												console.log(err)
											}
										})
									}
								}
							})
						} else {
							console.log("登录失败！" + res.errMsg);
						}
					}
				});
			},
			//签到列表
			getSignList() {
				this.$http.get('/user/SignList').then((response) => {
					const res = response.data;
					if (res.code == 0) {
						this.signList = res.data.list;
						this.signBut = res.data.sign;
						this.integralNum = res.data.integral;
						this.initData();
						console.log(this.signList)
					}
				})
			},
			//立即签到
			hanldQian() {
				this.$http.post('/user/sign').then((response) => {
					const res = response.data;
					if (res.code == 0) {
						this.getSignList()
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				})
			},
			//客服
			hanldKefu() {

				this.$http.get('/user/kefu').then((response) => {
					const res = response.data;
					if (res.code == 0) {
						this.kefu = res.data;
						console.log(this.kefu)
						console.log("this.kefu")
					}
				})
			},
			downloadImageOfMp(image) {
				let _this = this

				uni.downloadFile({
					url: image,
					success(res) {
						uni.saveImageToPhotosAlbum({
							filePath: res.tempFilePath,
							success() {
								uni.showToast({
									title: '保存成功',
									icon: 'none'
								});
							},
							fail() {
								uni.showToast({
									title: '保存失败',
									icon: 'none'
								});
							}
						});
					},
					fail() {
						_this.$common.errorToShow('下载失败')
					}
				})
			},
			//绑定手机号
			hanldBind(e) {
				const formData = {
					iv: e.detail.iv,
					encryptedData:e.detail.encryptedData
				}
				this.$http.post('/user/bind', formData).then((response) => {
					const res = response.data;
					if(res.code==0){
						
					}
					uni.showToast({
						title: res.msg,
						icon: 'none'
					});
				})
			},
			//交押金支付
			hanldPaly() {
				let that = this;
					const formData = {
					  type: 1
					}
					this.$http.post('/wechat/wxPay', formData).then((response) => {
						const res = response.data;
						if(res.code==0){
							wx.requestPayment({
							  timeStamp: res.data.timeStamp,
							  nonceStr: res.data.nonceStr,
							  package: res.data.package,
							  signType: "MD5",
							  paySign: res.data.paySign,
							  success(res) {
								uni.showToast({title: res.msg, icon: 'none'});
								that.hanldYj()
							    console.log(res + "支付接口");
							  },
							  fail(res) {
							   uni.showToast({title: res.msg, icon: 'none'});
							  }
							});
						}
						uni.showToast({title: res.msg, icon: 'none'});
						this.$refs.cash.close()
					})
				}
			
		}
	}
</script>

<style>
	.user>>>uni-button:after {
		display: none;
	}

	.user>>>button:after {
		display: none;
	}
</style>

<style lang="scss" scoped>
	.mesage{
		height: 20px;
		width: 20px;
		background-color: #FF5F49;
		border-radius: 50%;
		margin-right: 5px;
		text-align: center;
		color: #fff;
		line-height: 20px;

	}
	.user {
		background-color: #f9f9f9;
	}

	.qian {
		height: 419px;
		width: 640upx;
		background-color: #fff;
		border-radius: 10px;
		text-align: center;
		padding: 0 8px;
		position: relative;
	}

	.qian-time image {
		width: 30px;
		height: 30px;

	}

	.qian-img {
		width: 206px;
		height: 144px;
		margin-top: -200upx;
	}

	.qian-time {
		background-color: #0A79FF;
		padding: 5px 4px;
		border-radius: 5px;
		color: #fff;
		text-align: center;
		display: flex;
		flex-direction: column;

	}

	.qian-time .text {
		line-height: 1.5;
		font-size: 12px;
	}

	.qian-warppper {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}

	.qian-but2 {
		width: 413upx;
		height: 90upx;
		background: #DDDFE0;
		border-radius: 45upx;
		font-size: 18px;
		color: #fff;
		font-weight: bold;
		line-height: 90upx;
		text-align: center;
		margin: 44px auto 15px auto;
	}

	.qian-but {
		width: 413upx;
		height: 90upx;
		background: rgba(255, 95, 73, 1);
		box-shadow: 0px 10upx 30upx 0px rgba(255, 95, 73, 0.2);
		border-radius: 45upx;
		font-size: 18px;
		color: #fff;
		font-weight: bold;
		line-height: 90upx;
		text-align: center;
		margin: 44px auto 15px auto;
	}

	.but-text {
		background-color: #27282D;
		color: #EFD7AA;
		border-radius: 10px;
		padding: 0 10px 0 17px;
		text-align: left;
		line-height: 22px;
		background-color: #27282D;
		color: #EFD7AA;
		border-radius: 10px;
		padding: 0 5px 0 13px;
		height: 22px;
		left: -18upx;
		position: relative;
	}

	.but-text::after {
		width: 22px;
		height: 22px;
		content: "";
		left: -22upx;
		top: 0px;
		display: block;
		background: #FF5F49;
		border-radius: 20px;
		position: absolute;
	}

	.member-top {
		position: relative;
		width: 100%;
		color: #fff;
		background-color: #FF5F49;
		font-size: 12px;
		/*  #ifdef MP-WEIXIN  */
		padding-top: 20px;
		/*  #endif  */

	}

	.bg-img {
		position: absolute;
		width: 100%;
		height: 100%;
	}

	.bangsj {
		font-size: 12px;
		color: #fff;
		border: 1px solid #fff;
		border-radius: 4px;
		text-align: center;
		margin-top: 10upx;
		padding: 0 5px;
		line-height: 2;
		background: none;
		color: #FFFFFF;
		position: absolute;
		left: 140upx;
		top:60upx
	}

	.member-top-c {
		flex-direction: row;
		height: 113px;
		align-items: center;
		width: 100%;
		display: flex;
		justify-content: space-between;

	}

	.user-head-img {
		display: block;
		width: 120upx;
		height: 120upx;
		border-radius: 50%;
		overflow: hidden;
		background-color: rgba(255, 255, 255, 0.7);
		margin: 0 auto 16upx;
	}

	.user-name {
		font-size: 30upx;
		color: #fff;
		margin-bottom: 16upx;
	}

	.grade {
		color: #FFF;
	}

	.member-grid {
		background-color: #fff;
		border-top: 2upx solid #eee;
		padding: 20upx 0;
	}

	.margin-cell-group {
		margin: 20upx 0;
		color: #666666;
	}

	.badge {
		right: 80upx;
		top: -6upx;
	}

	button.cell-item-hd {
		background-color: #fff;
		padding: 0;
		line-height: 1.4;
		color: #333;
	}

	button.cell-item-hd:after {
		border: none;
	}

	.login-btn {
		color: #fff;
		width: 180upx;
		height: 50upx;
		line-height: 50upx;
		border-radius: 25upx;
		background: #ff7159;
		font-size: 12px;
	}

	.sale-block {
		padding: 0 20upx;
		margin-bottom: 20upx;

		.sale-title {
			height: 72rpx;
			line-height: 72rpx;
			border-bottom: 2rpx solid #f0f0f0;
			display: flex;
			align-items: center;

			.iconfont {
				margin-right: 12upx;
			}
		}

		.sale-list {
			justify-content: flex-start;
			flex-wrap: wrap;

			.item {
				width: 25%;
				padding: 20upx 0;

				.iconfont {
					font-size: 40upx;
					color: #5e5e5e;
				}

				.text {
					margin-top: 12upx;
					color: #4d4d4d;
					font-size: 24rpx;
					position: relative;
				}
			}

			.tc {
				text-align: center;

				.cell-hd-icon {
					float: none;
					width: 60rpx;
					height: 60rpx;
					margin: 0;
				}
			}
		}
	}

	.coupon {
		top: -40px;
		left: 50px;
	}

	/*积分*/
	.inte-list {
		display: flex;
		flex-direction: row;
		justify-content: end;
		margin: 15px 17px;
	}

	.init-title {
		font-size: 18px;
		font-weight: bold;
	}

	.inte-item {
		display: flex;
		flex-direction: column;
		margin-right: 40px;
	}

	.car-wrapper {
		background-color: #27282D;
		height: 44px;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		line-height: 44px;
		align-items: center;
		margin: 0 17px;
		border-radius: 10px 10px 0px 0px;
		padding: 0 17px;
	}

	.car-text {
		flex: 1;
		margin-left: 8px;
		font-size: 12px;
		color: #EFD7AA;
	}

	.car-wrapper image {
		width: 24px;
		height: 19px;
	}

	.car-but {
		width: 74px;
		height: 26px;
		background: rgba(239, 215, 170, 1);
		border-radius: 13px;
		line-height: 26px;
		text-align: center;
		color: #27282D;
	}

	.qiandao {
	    width: 228upx;
	    height: 72upx;
	    border-radius: 5px;
	    color: #27282D;
	    text-align: center;
	    line-height: 72upx;
	    background-color: #EFD7AA;
	    display: -webkit-box;
	    display: -webkit-flex;
	    display: flex;
	    -webkit-box-orient: horizontal;
	    -webkit-box-direction: normal;
	    -webkit-flex-direction: row;
	    flex-direction: row;
	    -webkit-box-align: center;
	    -webkit-align-items: center;
	    align-items: center;
	    margin-top: 60upx;
	    /* position: absolute; */
	    margin-right: -40upx;
	    border-radius: 20px 0px 0 20px;
	    justify-content: space-evenly;


	}

	.kf-title {
		color: #14172C;
		font-size: 17px;
		font-weight: bold;
	}

	.kf-main {
		color: #A4A5B0;
		font-size: 14px;
		padding: 0px 0 10px 0;
	}

	.kf-img {
		width: 200px;
		height: 200px;
	}

	.kf-text {
		color: #A4A5B0;
		font-size: 14px;
		padding: 0px 0 10px 0;
	}

	.kf-but {
		margin: 0 20px;
		height: 44px;
		background: rgba(255, 95, 73, 1);
		border-radius: 3px;
		text-align: center;
		line-height: 44px;
		color: #FFFFFF;
		font-size: 16px;
	}

	.cash {
		height: 226px;
		width: 640upx;
		background-color: #fff;
		border-radius: 10px;
		text-align: center;
		padding: 0 25px;
		position: relative;
	}

	.cash-but {
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		margin-top: 50px;
	}

	.cash-title {
		color: #14172C;
		font-weight: bold;
		font-size: 17px;
		padding: 20px 0;
	}

	.cash-text {
		color: #666666;
		text-align: left;
		font-size: 14px;
	}

	.cash-left {
		width: 228upx;
		height: 34px;
		background: rgba(245, 245, 245, 1);
		border-radius: 5px;
		color: #999999;
		font-size: 14px;
		line-height: 34px;
	}

	.cash-right {
		width: 228upx;
		height: 34px;
		background: rgba(255, 95, 73, 1);
		border-radius: 5px;
		color: #fff;
		font-size: 14px;
		line-height: 34px;
	}

	.xit-h {
		width: 7px;
		height: 7px;
		background: #ff5f49;
		border-radius: 50%;
		position: absolute;
		right: 15px;
	}

	/*授权*/
	.dialog-mask {
		position: fixed;
		z-index: 1000;
		top: 0;
		right: 0;
		left: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.3);
	}

	.dialog-info {
		position: fixed;
		z-index: 5000;
		width: 80%;
		max-width: 600rpx;
		top: 50%;
		left: 50%;
		-webkit-transform: translate(-50%, -50%);
		transform: translate(-50%, -50%);
		background-color: #ffffff;
		text-align: center;
		overflow: hidden;
	}

	.dialog-title {
		font-size: 36rpx;
		padding: 30rpx 30rpx 10rpx;
	}

	.dialog-content {
		padding: 10rpx 30rpx 20rpx;
		min-height: 80rpx;
		font-size: 32rpx;
		line-height: 1.3;
		word-wrap: break-word;
		word-break: break-all;
		color: #999999;
	}

	.dialog-footer {
		display: flex;
		align-items: center;
		position: relative;
		line-height: 90rpx;
		font-size: 34rpx;
	}

	.dialog-btn {
		display: block;
		-webkit-flex: 1;
		flex: 1;
		position: relative;
		font-size: 16px;
	}

	button {
		background-color: #fff;
		border-radius: 0;
	}

	button::after {
		border-radius: 0;
	}

	.sticStyle {
		background-color: #FF5F49 !important;
		color: #FFFFFF !important;
	}
	
	
	.flex-style{
		display: flex;flex-direction: row;width: 100%;
	}
		
	.name-text{
			width: 100px;
	            overflow: hidden;/*超出部分隐藏*/
	            white-space: nowrap;/*不换行*/
	            text-overflow:ellipsis;/*超出部分文字以...显示*/	
	}
	
	/*iphone x*/
	@media only screen and (device-width: 414px) and (device-height: 896px) {
      .member-top-c{
		  height: 150px !important;
	  }
	  .inte-list{
		      margin: 0px 17px 17px 15px !important;
	  }
	}
	
	@media only screen and (device-width: 562px) and (device-height: 1218px) {
	 .member-top-c{
	 		  height: 150px !important;
	 }
	 .inte-list{
	 		      margin: 0px 17px 17px 15px !important;
	 }
	}
	
	@media only screen and (device-width: 375px) and (device-height: 812px) {
	 .member-top-c{
	 		  height: 150px !important;
	 }
	.inte-list{
			      margin: 0px 17px 17px 15px !important;
	}
	}
	
</style>
